#include <cstdio>
#include <cstring>
#include <map>
const int MAXN = 1000001;
char pat[][10] = {"", "one", "puton", "out", "output", "in", "input"}, now[MAXN]={0}, sub[10] = {0};
int lent[] = {0, 3, 5, 3, 6, 2, 5}, f[MAXN];
int n;
int main() {
    std::map<char, bool> ma;
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
        scanf("%s", now);
        int slen = strlen(now);
        f[0] = i;
        for (int j = 1; j <= slen; j++)
            if()
                for (int k = 1; k <= 6; ++k)
                    if(j - lent[k] >= 0) {
                        strncpy(sub, now + (j - lent[k]), lent[k]);
                        sub[lent[k]] = '\0';
                        if(!strcmp(sub, pat[k]))
                            f[j] = f[j] == i || f[j - lent[k]] == i ? i : f[j];
                    }
        if(f[slen] == i) printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}
